*** Settings ***
Documentation    TC09-Round Management FCL-Lock Unlock
Resource    ../../Keywords/Common_Head.robot
Force Tags    P3
Metadata    Author    Nella
Metadata    ID    6854458


*** Test Cases ***
TC09-Round Management FCL-Lock Unlock
    Step 1 User Goes To Basic Data Management Tender List
    Step 2 User Goes To Pricing Collaboration Pricing Project
    Step 3 User Selects Row That Project Name Is 20240815 FCL
    Step 4 Select Current Project In Pricing Project Click On
    Step 5 User Clicks Next Round Management Button
    Step 6 Exchange To Role Project Owner Click On Lock Button
    Step 7 Select Current Role As Project Owner
    Step 8 Exchange Role To Country Pricing Manager US
    Step 9 Exchange Role To Country Pricing Manager DE CN N AU US
    Step 10 Exchange The Role To Cluster Head TLM EU GREATER CHINA
    Step 11 Lock Success
    Step 12 Close This Pop up Dialog
    Step 13 Exchange The Role To Region Pricing Manager EUROPE NAM
    Step 14 Close This Pop up Dialog Click On Unlock Button
    Step 15 Close This Pop up Dialog Download IPT
    Step 16 Exchange The Role To Project Owner
    Step 17 Select All
    Step 18 Close The Dialog Check The Dropdown List Of Current
    Step 19 Exchange The Role To Region Pricing Manager EUROPE 
    Step 20 Select All Click Unlock button
    Step 21 Close The Dialog Check The Dropdown List 
    Step 22 Exchange To Any Of The Role
    Step 23 Exchange Current Role To Project Owner
    Step 24 Click On Close Button
    Step 25 Select This Project Click On Delete Project Button
    Step 26 Search out the tender created in step1



*** Keywords ***
Step ${step} User Goes To Basic Data Management Tender List
    #************************Step 1******************************
    #  Do:
    #      User goes to Basic Data Management Tender List
    #      Click Create button
    #      Input with following attributes
    #      Tender ID some numbers such as 202408151435001 you can
    #     input with current datetime and some random number to
    #     avoid duplicate validation
    #      Tender Title some value such as Regression Test by
    #     Wendy001
    #      Customer 815 Miele
    #      Mode select all
    #      Level Global
    #      Click on Save button
    #  Expected:
    #      Created successfully with the message Tender has been
    #     added
    #************************************************************
    ${G_TENDERID}    Generate Tender ID
    Set Suite Variable     ${G_TENDERID}
    Login Space
    Create Tender    ${G_TENDERID}    Regress    815    true    true    true

Step ${step} User Goes To Pricing Collaboration Pricing Project
    #************************Step 2******************************
    #  Do:
    #      User goes to Pricing Collaboration Pricing Project
    #      User clicks Create Project button
    #      Input following attributes
    #      Tender ID 20240815 Regression
    #      Mode FCL
    #      Deadline to TM current date 10 day
    #      Rate Validity From current date
    #      Rate Validity To current date 100 day
    #      Deputies NATZHANG
    #      Description for regression
    #      Click on Save button
    #  Expected:
    #      A new project is created successfully
    #************************************************************
    ${ValidFrom}    Get Current Date    result_format=%d/%m/%Y
    Set Test Variable    ${ValidFrom}    ${ValidFrom}
    ${DeadLine}    Get Current Date    UTC    +10days    result_format=%d/%m/%Y
    ${ValidTo}    Get Current Date    UTC    +100days    result_format=%d/%m/%Y
    ${PROJECT}    Copy Dictionary    ${PROJECT_PARAM}
    Set To Dictionary    ${PROJECT}    
    ...    TENDER_ID=${G_TENDERID}    TENDER_TITLE=Regress    CUSTOEMR_NAME=Miele    CUSTOMER_LEVEL=Global
    ...   MODE=FCL    DEADLINE_TM_DATE=${DeadLine}    VALID_FROM=${ValidFrom}    VALID_TO=${ValidTo}    DEPUTY=NATZHANG
    Set Suite Variable    ${PROJECT}    
    Create Project    ${PROJECT}

Step ${step} User Selects Row That Project Name Is 20240815 FCL
    #************************Step 3******************************
    #  Do:
    #      User selects row that project name is 20240815 FCL
    #     Regression
    #      Click on Copy Data
    #      In the pop up dialog input Tender ID with value
    #     2024000001 click on Search button
    #      Select this entry click on Copy Data button and Yes in
    #     pop up window
    #  Expected:
    #      Successfully with messages in pop up window
    #      Tender has been successfully copied from 2024000001 FCL
    #     do not touch me
    #      Please adjust the template and the lanes in Template
    #     Lane Management page if required
    #      After click on OK button
    #      The same message is displayed in Pricing Project page
    #     too
    #************************************************************
    Search Project    ${PROJECT.TENDER_ID}  
    Copy Data    2024000001    FCL    do not touch me

Step ${step} Select Current Project In Pricing Project Click On
    #************************Step 4******************************
    #  Do:
    #      Select current project in pricing project click on
    #     template management button
    #      Click Skip button in Step4 and Yes in the pop up
    #     windown
    #  Expected:
    #      Next Round Management button is enable
    #************************************************************
    Search Project    ${PROJECT.TENDER_ID}  
    Wait Until Search Finished
    Wait For Elements State    ${Project_toolbar_TemplateManagementButton}   enabled    20
    Click    ${Project_toolbar_TemplateManagementButton}
    click    ${Template_SkipSendToGPDButton}
    click    ${SkipSendToGPD_Yes}
    Wait For Elements State    css=[data-ng-click="go2NextStep()"]   enabled    20

Step ${step} User Clicks Next Round Management Button
    #************************Step 5******************************
    #  Do:
    #      User clicks Next round management button
    #      Set deadline of each region, Assign WENDJIAN to each Region start round send
    #     notification
    #      Set deadline of each cluster, tradelane and country as current date,Assign WENDJIAN to each Cluster and Country Trade lane
    #     send notification
    #      Reopen the round management window check the dropdown
    #     list of current role
    #  Expected:
    #      All of the country trade lane and cluster are all
    #     display in the dropdown list with the background color
    #     yellow index php attachments get ff7db4cf c34b 42ba a8ab
    #     3c1c87af332d
    #************************************************************
    click    css=[data-ng-click="go2NextStep()"]
    Wait Until Search Finished
    Input Deadline In Region Tab    
    Input Deadline In Region Tab  0    1
    Input Deadline In Region Tab  1    0
    CLICK    [data-ng-click="addUserToAssignment()"]
    Round Mgmt Assign User    ${Project_RoundMgmt_Assign_ApacTab}    xpath=//div[@data-model='availableItems']//ul//li//b[.='Wendy Jiang (WENDJIAN)']
    Round Mgmt Assign User    ${Project_RoundMgmt_Assign_EuropeTab}    xpath=//div[@data-model='availableItems']//ul//li//b[.='Wendy Jiang (WENDJIAN)']
    Round Mgmt Assign User    ${Project_RoundMgmt_Assign_NamTab}    xpath=//div[@data-model='availableItems']//ul//li//b[.='Wendy Jiang (WENDJIAN)']
    click    ${Project_RoundMgmt_Assign_SaveButton} 
    click    ${Project_RoundMgmt_StartButton} 
    click    ${Project_RoundMgmt_StartConfirmButton}
    click    ${Project_RoundMgmt_Confirm_SendButton}
    click    ${Project_RoundMgmt_CloseButton}
    close browser
    Set Global Variable    ${USERNAME}    WENDJIAN
    Login Space
    Search Project    ${PROJECT.TENDER_ID}
    Wait Until Search Finished
    Wait Until Keyword Succeeds    10x    500ms    Click    ${Project_toolbar_RoundMgmtButton}
    Wait For Elements State    //div[@ng-click="toggleDropdown()"]
    Click    //div[@ng-click="toggleDropdown()"]
    Click    //div[contains(text(),"Regional Pricing Manager(EUROPE,NAM,APAC)")]
    Input Deadline In Country Tab   0    0
    Input Deadline In Country Tab    0    1
    Input Deadline In Country Tab    1    0
    Input Deadline In Country Tab    1    1
    click    //a[.='Cluster']
    Input Deadline In Cluster Tab   0    0
    Input Deadline In Cluster Tab    0    1
    Input Deadline In Cluster Tab    1    0
    Input Deadline In Cluster Tab    1    1
    Input Deadline In Cluster Tab    2    0
    click    //a[.='Trade Lane Standard']
    Input Deadline In TradeLaneStandard Tab
    Input Deadline In TradeLaneStandard Tab    0    1
    CLICK    [data-ng-click="addUserToAssignment()"]
    Round Mgmt Assign User    //a[.='AU']   xpath=//div[@data-model='availableItems']//ul//li//b[.='Wendy Jiang (WENDJIAN)']
    Round Mgmt Assign User    //a[.='CN-C']     xpath=//div[@data-model='availableItems']//ul//li//b[.='Wendy Jiang (WENDJIAN)']
    Round Mgmt Assign User    //a[.='DE']    xpath=//div[@data-model='availableItems']//ul//li//b[.='Wendy Jiang (WENDJIAN)']
    Round Mgmt Assign User    //a[.='US']    xpath=//div[@data-model='availableItems']//ul//li//b[.='Wendy Jiang (WENDJIAN)']
    click    //a[.='Cluster']
    Round Mgmt Assign User    //a[.='Australia & New Zealand']   xpath=//div[@data-model='availableItems']//ul//li//b[.='Wendy Jiang (WENDJIAN)']
    Round Mgmt Assign User    //a[.='Germany & Switzerland']     xpath=//div[@data-model='availableItems']//ul//li//b[.='Wendy Jiang (WENDJIAN)']
    Round Mgmt Assign User    //a[.='Greater China']    xpath=//div[@data-model='availableItems']//ul//li//b[.='Wendy Jiang (WENDJIAN)']  
    Round Mgmt Assign User    //a[.='Trade Lane Manager Europe']    xpath=//div[@data-model='availableItems']//ul//li//b[.='Wendy Jiang (WENDJIAN)']  
    Round Mgmt Assign User    //a[.='Trade Lane Manager NAM']    xpath=//div[@data-model='availableItems']//ul//li//b[.='Wendy Jiang (WENDJIAN)']  
    click    //a[.='Trade Lane Standard']
    Round Mgmt Assign User    //a[.='APAC-US']    xpath=//div[@data-model='availableItems']//ul//li//b[.='Wendy Jiang (WENDJIAN)']
    Round Mgmt Assign User    //a[.='EMNEU-APOCE']    xpath=//div[@data-model='availableItems']//ul//li//b[.='Wendy Jiang (WENDJIAN)']
    click    ${Project_RoundMgmt_Assign_SaveButton} 
    click    ${Project_RoundMgmt_SendNotifButton}
    click    ${Project_RoundMgmt_Confirm_SendButton}
    Sleep    5
    Click    //div[@ng-click="toggleDropdown()"]

Step ${step} Exchange To Role Project Owner Click On Lock Button
    #************************Step 6******************************
    #  Do:
    #      Exchange to role Project Owner Click on Lock button
    #      Select NAM to lock
    #  Expected:
    #      Lock success
    #************************************************************
    Click    //div[contains(text(),"Project Owner")]
    click    ${Project_RoundMgmt_LockButton}
    click    //a[.='Region']
    click    //div[@class="tab-content"]//div[contains(text(),'NAM')]/..//input
    click    css=[data-ng-click="lock()"]
    click    css=[data-ng-click="$close()"]
    Wait For Elements State     //td[.='US']/..//td[.='Completed']   visible    20
    Click    //div[@ng-click="toggleDropdown()"]
    Wait For Elements State     //div[contains(text(),'Regional Pricing Manager(NAM)')]    visible    20
    click    ${Project_RoundMgmt_CloseButton}

Step ${step} Select Current Role As Project Owner
    #************************Step 7******************************
    #  Do:
    #      Select current role as Project Owner
    #      Click on Lock button
    #      In the pop up window Select NAM to Lock
    #      Close this window
    #      Check the dropdown list of current role
    #      Check dashboard Region tab Country Cluster tab
    #  Expected:
    #      It displays as
    #      index php attachments get f53eaae4 0cdc 4f7c a3b6
    #     c3fd942892eb
    #      index php attachments get 83d902bd 9bcc 4ac3 a82a
    #     3150131f3844 index php attachments get 72624650 95cb
    #     45bf af09 2be4746b0941
    #      index php attachments get 3ffdd227 6a4b 4242 9f4e
    #     3554e1af3b7a index php attachments get 8ed0c808 3ef9
    #     483d 938a ffbe938df229 index php attachments get
    #     d54ff99e 2a36 4db2 927f e36e513de75e
    #************************************************************
    Search Project    ${PROJECT.TENDER_ID}
    Wait Until Search Finished
    Wait For Elements State    ${Project_toolbar_RoundMgmtButton}   enabled    20
    Click    ${Project_toolbar_RoundMgmtButton}
    Click    //div[@ng-click="toggleDropdown()"]
    Wait For Elements State     //div[contains(text(),'Country Pricing Manager(US)')]    visible    20
    ${color}    Get Attribute        //div[contains(text(),'Country Pricing Manager(US)')]//span     style
    Should Contain    ${color}     green
    Get Element States    //div[contains(text(),'Regional Pricing Manager(NAM)')]     contains    visible
    ${color}    Get Attribute        //div[contains(text(),'Regional Pricing Manager(NAM)')]//span     style
    Should Contain    ${color}     green
    Get Element States    //div[contains(text(),'Cluster Head(TLM-NAM)')]     contains    visible
    ${color}    Get Attribute        //div[contains(text(),'Cluster Head(TLM-NAM)')]//span     style
    Should Contain    ${color}     green
    Get Element States    //div[contains(text(),'Trade Lane Pricing Manager(APAC-US)')]     contains    visible
    ${color}    Get Attribute        //div[contains(text(),'Trade Lane Pricing Manager(APAC-US)')]//span     style
    Should Contain    ${color}     green
    Click    //div[@ng-click="toggleDropdown()"]
    # no region tab,check with wendy
    Get Element States    //td[.='US']/..//td[.='Completed']   contains    visible
    Click    //a[.='Trade Lane Standard']
    Get Element States    //td[.='APAC-US']/..//td[.='Completed']   contains    visible
    Click    //a[.='Cluster']
    Get Element States    //td[.='Trade Lane Manager NAM']/..//td[.='Completed']   contains    visible
    Click    //a[.='Country/Trade Lane']
    Click    (//a[.='Trade Lane Standard'])[2]
    Get Element States    (//td[.='APAC-US']/..//td[.='Completed'])[2]   contains    visible

Step ${step} Exchange Role To Country Pricing Manager US
    #************************Step 8******************************
    #  Do:
    #      Exchange role to Country Pricing Manager US
    #  Expected:
    #      No submission button is displayed
    #************************************************************
    Click    //div[@ng-click="toggleDropdown()"]
    Wait For Elements State     //div[contains(text(),'Country Pricing Manager(US)')]    visible    20
    click    //div[contains(text(),'Country Pricing Manager(US)')]
    Wait For Elements State     ${Project_RoundMgmt_SubmissionButton}   detached     20

Step ${step} Exchange Role To Country Pricing Manager DE CN N AU US
    #************************Step 9******************************
    #  Do:
    #      Exchange role to Country Pricing Manager DE CN N AU US
    #      Download IPT
    #      Submission upload the downloaded file submit If errors
    #     please update some wrong values as the error messages
    #     hint
    #      Check the dropdown list of current role
    #      Check the dashboard
    #  Expected:
    #      index php attachments get 1839fbb0 ac37 4f26 b82e
    #     a4ea1ad616db index php attachments get da682159 ac4a
    #     4287 a10d 8e7b73326821
    #************************************************************
    Click    //div[@ng-click="toggleDropdown()"]
    Wait For Elements State     //div[contains(text(),'Country Pricing Manager(US)')]    visible    20
    click    //div[contains(text(),'Country Pricing Manager(DE,AU,CN-C,US)')]
    ${filename}    Download File    ${Project_RoundMgmt_DownloadButton}
    Wait Until Search Finished
    click    ${Project_RoundMgmt_SubmissionButton}
    click    css=[data-ng-change="selectAll(all)"]
    click    ${Project_RoundMgmt_Submit_UploadButton}
     Wait For Elements State   ${upload_addFileButton}     enabled
    Upload File By Selector    ${upload_addFileButton}    ${CURDIR}${/}TestData${/}AUTO 44031-FCL-Regress_Round1_IPT_11122024_IF_update.xlsx
    click    [data-ng-click="submitUploads()"]
     Wait For Elements State    //legend[.='Step 3: Submit Charges']/..//span[contains(text(),'SUCCESSFUL')]      visible    20  
     click    [data-ng-click="$close()"]   
    Click    //div[@ng-click="toggleDropdown()"]
    Wait For Elements State     //div[contains(text(),'Country Pricing Manager(US)')]    visible    20
    Sleep    3
    ${color2}    Get Attribute        //div[contains(text(),'Country Pricing Manager(DE)')]//span     style
    Should Contain    ${color2}     green
    ${color3}    Get Attribute        //div[contains(text(),'Country Pricing Manager(CN-C)')]//span     style
    Should Contain    ${color3}     green
    ${color4}    Get Attribute        //div[contains(text(),'Country Pricing Manager(AU)')]//span     style
    Should Contain    ${color4}     green
    Click    //div[@ng-click="toggleDropdown()"]
    click    //a[.='Country/Trade Lane/Cluster']
    click    //a[.='Country']
    Get Element States    //td[.='US']/..//td[.='Completed']   contains    visible
    Get Element States    //td[.='AU']/..//td[.='Completed']   contains    visible
    Get Element States    //td[.='CN-C']/..//td[.='Completed']   contains    visible
    Get Element States    //td[.='DE']/..//td[.='Completed']   contains    visible

Step ${step} Exchange The Role To Cluster Head TLM EU GREATER CHINA
    #************************Step 10******************************
    #  Do:
    #      Exchange the role to Cluster Head TLM EU GREATER CHINA
    #     TLM NAM AU NZ DE CH
    #      Click on Lock button
    #  Expected:
    #      In Country tab No countries listed here
    #      with the message Only unsubmitted countries will be
    #     listed here
    #      In Trade Lane Standard tab EMNEU APOCE is listed here
    #     select it click on Lock button
    #************************************************************
    Click    //div[@ng-click="toggleDropdown()"]
    Wait For Elements State     //div[contains(text(),'Cluster Head(TLM-EU,GREATER CHINA,TLM-NAM,AU-NZ,DE-CH)')]    visible    20
    click    //div[contains(text(),'Cluster Head(TLM-EU,GREATER CHINA,TLM-NAM,AU-NZ,DE-CH)')]
    click    ${Project_RoundMgmt_LockButton}
    Sleep    2
    click    //a[.='Country']
    Wait For Elements State    //b[.='Only unsubmitted countries will be listed here.']    visible    20
    click    //a[.='Trade Lane Standard']
    click    //div[@class="form-group"]//label[contains(.,'EMNEU-APOCE')]/..//input

Step ${step} Lock Success
    #************************Step 11******************************
    #  Do:
    #      Lock success
    #      Close this pop up dialog click on Unlock button
    #  Expected:
    #      In Country tab no US others are all listed
    #      index php attachments get 6a88d5c5 f3b0 4a98 9be8
    #     a2a255de0707
    #************************************************************
    click    css=[data-ng-click="lock()"]
    click    css=[data-ng-click="$close()"]
    Click    ${Project_RoundMgmt_UnlockButton}
    Sleep    2
    click    //a[.='Country']
    Wait For Elements State    //label[contains(text(),'CN-C')]        visible    20
    Wait For Elements State    //label[contains(text(),'DE')]        visible    20
    Wait For Elements State    //label[contains(text(),'AU')]        visible    20
    click    [data-ng-click="$close()"]   

Step ${step} Close This Pop up Dialog
    #************************Step 12******************************
    #  Do:
    #      Close this pop up dialog
    #      Download IPT
    #      Submission upload the downloaded file submit If errors
    #     please update some wrong values as the error messages
    #     hint
    #      Check the dropdown list of current role
    #      Check the dashboard
    #  Expected:
    #      index php attachments get ab21a1f0 27c0 45aa 9347
    #     4d104b2faf08 index php attachments get c2511b9d 92b8
    #     4341 8179 442f8577c936
    #************************************************************
    ${filename}    Download File    ${Project_RoundMgmt_DownloadButton}
    Wait Until Search Finished
    click    ${Project_RoundMgmt_SubmissionButton}
    click    css=[data-ng-change="selectAll(all)"]
    click    ${Project_RoundMgmt_Submit_UploadButton}
     Wait For Elements State   ${upload_addFileButton}     enabled
    Upload File By Selector    ${upload_addFileButton}    ${CURDIR}${/}TestData${/}AUTO 44031-FCL-Regress_Round1_IPT_11122024_aN_update.xlsx
    click    [data-ng-click="submitUploads()"]
     Wait For Elements State    //legend[.='Step 3: Submit Charges']/..//span[contains(text(),'SUCCESSFUL')]      visible    20  
     click    [data-ng-click="$close()"]   
    Click    //div[@ng-click="toggleDropdown()"]
    Wait For Elements State     //div[contains(text(),'Country Pricing Manager(US)')]    visible    20
    Sleep    3
    ${color2}    Get Attribute        //div[contains(text(),'Cluster Head(GREATER CHINA)')]//span     style
    Should Contain    ${color2}     green
    ${color3}    Get Attribute        //div[contains(text(),'Cluster Head(AU-NZ)')]//span     style
    Should Contain    ${color3}     green
    ${color4}    Get Attribute        //div[contains(text(),'Cluster Head(DE-CH)')]//span     style
    Should Contain    ${color4}     green
    Click    //div[@ng-click="toggleDropdown()"]
    Click    //a[.='Cluster']
    Get Element States    //td[.='Australia & New Zealand']/..//td[.='Completed']   contains    visible
    Get Element States    //td[.='Germany & Switzerland']/..//td[.='Completed']   contains    visible
    Get Element States    //td[.='Greater China']/..//td[.='Completed']   contains    visible
    Get Element States    //td[.='Trade Lane Manager Europe']/..//td[.='Completed']   contains    visible
    Get Element States    //td[.='Trade Lane Manager NAM']/..//td[.='Completed']   contains    visible

Step ${step} Exchange The Role To Region Pricing Manager EUROPE NAM
    #************************Step 13******************************
    #  Do:
    #      Exchange the role to Region Pricing Manager EUROPE NAM
    #     APAC
    #      Click on Lock button
    #  Expected:
    #      In Country tab No countries listed here
    #      with the message Only unsubmitted countries will be
    #     listed here
    #************************************************************
    Click    //div[@ng-click="toggleDropdown()"]
    Wait For Elements State     //div[contains(text(),'Regional Pricing Manager(EUROPE,NAM,APAC)')]    visible    20
    click    //div[contains(text(),'Regional Pricing Manager(EUROPE,NAM,APAC)')]
    click    ${Project_RoundMgmt_LockButton}
    Sleep    2
    click    //a[.='Country']
    Wait For Elements State    //b[.='Only unsubmitted countries will be listed here.']    visible    20

Step ${step} Close This Pop up Dialog Click On Unlock Button
    #************************Step 14******************************
    #  Do:
    #      Close this pop up dialog click on Unlock button
    #  Expected:
    #      In Country tab no US others are all listed
    #      index php attachments get 8702b874 75bb 484f b0a3
    #     244b14e1b1d7
    #      In Trade Lane Standard tab only EMNEU APOCE is listed
    #     here
    #************************************************************
    click    [data-ng-click="$close()"]   
    click    ${Project_RoundMgmt_UnlockButton}
    Sleep    3
    click    //a[.='Country']
    Wait For Elements State    //label[contains(text(),'CN-C')]        visible    20
    Wait For Elements State    //label[contains(text(),'DE')]        visible    20
    Wait For Elements State    //label[contains(text(),'AU')]        visible    20
    click    //a[.='Trade Lane Standard']
    Wait For Elements State    //label[contains(.,'EMNEU-APOCE')]        visible    20

Step ${step} Close This Pop up Dialog Download IPT
    #************************Step 15******************************
    #  Do:
    #      Close this pop up dialog
    #      Download IPT
    #      Submission upload the downloaded file submit
    #      Check the dropdown list of current role
    #      Check the dashboard
    #  Expected:
    #      index php attachments get 0d11537d bc8e 4288 abbd
    #     6dfd669a4546 index php attachments get 9b420a59 dd57
    #     4c3c b2c1 57cc9c9b737a
    #************************************************************
    click    [data-ng-click="$close()"]   
    ${filename}    Download File    ${Project_RoundMgmt_DownloadButton}
    Wait Until Search Finished
    click    ${Project_RoundMgmt_SubmissionButton}
    click    css=[data-ng-change="selectAll(all)"]
    click    ${Project_RoundMgmt_Submit_UploadButton}
     Wait For Elements State   ${upload_addFileButton}     enabled
    Upload File By Selector    ${upload_addFileButton}    ${filename}
    click    [data-ng-click="submitUploads()"]
     Wait For Elements State    //legend[.='Step 3: Submit Charges']/..//span[contains(text(),'SUCCESSFUL')]      visible    20  
     click    [data-ng-click="$close()"]   
    Click    //div[@ng-click="toggleDropdown()"]
    Wait For Elements State     //div[contains(text(),'Regional Pricing Manager(EUROPE,NAM,APAC)')]    visible    20
    Sleep    3
    ${color2}    Get Attribute        //div[contains(text(),'Regional Pricing Manager(EUROPE)')]//span     style
    Should Contain    ${color2}     green
    ${color3}    Get Attribute        //div[contains(text(),'Regional Pricing Manager(NAM)')]//span     style
    Should Contain    ${color3}     green
    ${color4}    Get Attribute        //div[contains(text(),'Regional Pricing Manager(APAC)')]//span     style
    Should Contain    ${color4}     green

Step ${step} Exchange The Role To Project Owner
    #************************Step 16******************************
    #  Do:
    #      Exchange the role to Project Owner
    #      Click on Unlock button
    #  Expected:
    #      All the regions are listed here index php attachments
    #     get 98b07427 80c4 4190 bef4 6c875f41c16d
    #************************************************************
    Click    //div[contains(text(),'Project Owner')]
    click    ${Project_RoundMgmt_UnlockButton}
    Sleep    3
    click    //a[.='Region']
    Wait For Elements State    //div[contains(text(),'APAC')]        visible    20
    Wait For Elements State    //div[contains(text(),'EUROPE')]        visible    20
    Wait For Elements State    //div[contains(text(),'NAM')]        visible    20

Step ${step} Select All
    #************************Step 17******************************
    #  Do:
    #      Select All
    #      Click on Unlock button
    #  Expected:
    #      Unlock success and all regions are removed from this
    #     page
    #************************************************************
    click    css=[data-ng-change="selectAll('region',lockAll.regionSelectAll)"]
    click    css=[data-ng-click="unlock()"]
    Wait For Elements State    //b[.='Only submitted region will list here.']    visible    20

Step ${step} Close The Dialog Check The Dropdown List Of Current
    #************************Step 18******************************
    #  Do:
    #      Close the dialog Check the dropdown list of current
    #     role
    #  Expected:
    #      index php attachments get cd989e11 3818 4add 9a06
    #     a58edd21677a
    #************************************************************
    click    [data-ng-click="$close()"]   
    Click    //div[@ng-click="toggleDropdown()"]
    Wait For Elements State     //div[contains(text(),'Regional Pricing Manager(EUROPE,NAM,APAC)')]    visible    20
    Sleep    3
    ${color2}    Get Attribute        //div[contains(text(),'Regional Pricing Manager(EUROPE)')]//span     style
    Should Contain    ${color2}     orange
    ${color3}    Get Attribute        //div[contains(text(),'Regional Pricing Manager(NAM)')]//span     style
    Should Contain    ${color3}     orange
    ${color4}    Get Attribute        //div[contains(text(),'Regional Pricing Manager(APAC)')]//span     style
    Should Contain    ${color4}     orange   

Step ${step} Exchange The Role To Region Pricing Manager EUROPE 
    #************************Step 19******************************
    #  Do:
    #      Exchange the role to Region Pricing Manager EUROPE NAM
    #     APAC
    #      Click on UnLock button
    #  Expected:
    #      All countries and trade lanes are listed here
    #      index php attachments get 2517b63e 9991 45c3 872b
    #     d075280bc53a index php attachments get efdcc521 d31f
    #     41cb 8b23 708327cd307a
    #************************************************************
    click    //div[contains(text(),'Regional Pricing Manager(EUROPE,NAM,APAC)')]
    click    ${Project_RoundMgmt_UnlockButton}
    Sleep    3
    click    //a[.='Country']
    Wait For Elements State    //label[contains(text(),'AU')]        visible    20
    Wait For Elements State    //label[contains(text(),'CN-C')]        visible    20
    Wait For Elements State    //label[contains(text(),'DE')]        visible    20
    Wait For Elements State    //label[contains(text(),'US')]        visible    20
    click    css=[data-ng-change="selectAll('country',lockAll.countrySelectAll)"]
    click    css=[data-ng-click="unlock()"]
    Sleep    4
    click    //a[.='Trade Lane Standard']
    Wait For Elements State    //label[contains(.,'EMNEU-APOCE')]        visible    20
    Wait For Elements State    //label[contains(.,'APAC-US')]        visible    20

Step ${step} Select All Click Unlock button
    #************************Step 20******************************
    #  Do:
    #      Select All
    #      Click Unlock button
    #  Expected:
    #      Unlock success
    #************************************************************
    click    //div[@class="form-group"]//label[contains(.,'EMNEU-APOCE')]/..//input
    click    //div[@class="form-group"]//label[contains(.,'APAC-US')]/..//input
    click    css=[data-ng-click="unlock()"]
    Wait For Elements State    //span[.='Unlock success.']    visible    20

Step ${step} Close The Dialog Check The Dropdown List 
    #************************Step 21******************************
    #  Do:
    #      Close the dialog check the dropdown list of Current
    #     Role
    #  Expected:
    #      index php attachments get f3dd0873 ef20 4013 9b27
    #     92c470e3af0d
    #************************************************************
    click    [data-ng-click="$close()"]   
    Click    //div[@ng-click="toggleDropdown()"]
    Wait For Elements State     //div[contains(text(),'Cluster Head(TLM-EU,GREATER CHINA,TLM-NAM,AU-NZ,DE-CH)')]    visible    20
    Sleep    3
    ${color2}    Get Attribute        //div[contains(text(),'Cluster Head(GREATER CHINA)')]//span     style
    Should Contain    ${color2}     orange
    ${color3}    Get Attribute        //div[contains(text(),'Cluster Head(AU-NZ)')]//span     style
    Should Contain    ${color3}     orange
    ${color4}    Get Attribute        //div[contains(text(),'Cluster Head(DE-CH)')]//span     style
    Should Contain    ${color4}     orange   
    ${color5}    Get Attribute        //div[contains(text(),'Country Pricing Manager(DE)')]//span     style
    Should Contain    ${color5}     orange
    ${color6}    Get Attribute        //div[contains(text(),'Country Pricing Manager(CN-C)')]//span     style
    Should Contain    ${color6}     orange
    ${color7}    Get Attribute        //div[contains(text(),'Country Pricing Manager(AU)')]//span     style
    Should Contain    ${color7}     orange   
    ${color8}    Get Attribute        //div[contains(text(),'Country Pricing Manager(US)')]//span     style
    Should Contain    ${color8}     orange      
    ${color9}    Get Attribute        //div[contains(text(),'Cluster Head(TLM-EU)')]//span     style
    Should Contain    ${color4}     orange 
    ${color10}    Get Attribute        //div[contains(text(),'Cluster Head(TLM-NAM)')]//span     style
    Should Contain    ${color4}     orange 

Step ${step} Exchange To Any Of The Role
    #************************Step 22******************************
    #  Do:
    #      Exchange to any of the role
    #  Expected:
    #      The Submission button is enable
    #************************************************************
    click    //div[contains(text(),'Regional Pricing Manager(EUROPE,NAM,APAC)')]
    Wait For Elements State     ${Project_RoundMgmt_SubmissionButton}   enabled     20

Step ${step} Exchange Current Role To Project Owner
    #************************Step 23******************************
    #  Do:
    #      Exchange current role to Project Owner
    #      Click on Close Round button
    #      In pop up dialog
    #      Select Send notification to all pricing manager
    #      User clicks yes button
    #  Expected:
    #      1 A prompt says Close Success
    #      2 Current Pricing Round 1 Closed 2 lanes
    #      3 There have new round button and reopen round button
    #************************************************************
    Click    //div[@ng-click="toggleDropdown()"]
    click    //div[contains(text(),'Project Owner')]
    click    ${Project_RoundMgmt_CloseRoundButton}
    click    //span[.='Send notification to all pricing manager.']
    click    ${Project_RoundMgmt_StartConfirmButton} 
    Wait For Elements State    //span[.='Close Success']    visible    20
    Wait For Elements State    //span[.='1 (Closed) 2 lanes']    visible    20
    Wait For Elements State    css=[data-ng-click="newRound()"]    visible    20
    Wait For Elements State    css=[data-ng-click="reopenRound()"]    visible    20

Step ${step} Click On Close Button
    #************************Step 24******************************
    #  Do:
    #      Click on Close button
    #      In Pricing Project page User selects TenderID Contains
    #     20240815
    #  Expected:
    #      The project could be found
    #************************************************************
    CLICK    ${Project_RoundMgmt_CloseButton}
    Wait For Elements State    //td[contains(text(),'${G_TENDERID}')]    visible    20
    close browser
    Set Global Variable    ${USERNAME}    AUTOTEST
    Login Space

Step ${step} Select This Project Click On Delete Project Button
    #************************Step 25******************************
    #  Do:
    #      Select this project click on Delete Project button
    #      Click Yes of the pop up confirm window
    #      If Delete Project button is disable do Data Cleaning
    #     and cancel first and then Delete Project button is
    #     enable
    #  Expected:
    #      System displays Project has been deleted
    #************************************************************
    LOG    teardown

Step ${step} Search out the tender created in step1
    #************************Step 26******************************
    #  Do:
    #      User goes to Basic Data Management Tender List
    #      Search out the tender created in step1
    #      Click on Delete button
    #      Click on Yes button in the popup dialog
    #  Expected:
    #      System displays Tender has been deleted
    #************************************************************
    LOG    teardown

